<template>
  <div class="wrap">
    <div class="item" v-for="item in list" :key="item.id">
      <p class="code">订单号: {{item.out_trade_no}}</p>
      <div class="title">
        <div class="ll">
          <p class="li">{{item.product_type==1?'半年会员':'一年会员'}}</p>
          <p class="time">{{item.create_time}}</p>
        </div>
        <p class="price">￥{{item.total_fee/100}}</p>
      </div>
    </div>
    <van-empty description="暂无数据" v-if="state==1" />
  </div>
</template>
<style scoped lang="scss">
.wrap {
  background: #f8f8f8;
  height: 100vh;
  overflow-y: scroll;
}
.item {
  width: 8.8rem;
  margin: 0.2rem auto;
  padding: 0.2rem 0.4rem;
  background: #fff;
  border-radius: 4px;
  .code {
    text-align: left;
    color: #555;
    font-size: 0.4rem;
    line-height: 0.6rem;
    border-bottom: 1px solid #f8f8f8;
    padding-bottom: 0.2rem;
  }
  .title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    margin: 0.2rem 0;
    .ll {
      .time {
        color: #999;
        font-size: 12px;
        margin-top: 0.2rem;
      }
      .li {
        font-size: 0.44rem;
        font-weight: bold;
        color: #555;
        margin-top: 0.2rem;
      }
    }
    .price {
      color: #f00;
      font-size: 18px;
      font-weight: 600;
    }
  }
  .content {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
}
</style>
<script>
import { getPayHistory } from "@/utils/interface";
import { Empty } from "vant";

export default {
  components: {
    Empty
  },
  data() {
    return {
      list: [],
      state: 0
    };
  },
  created() {
    document.title = "历史续费";
    getPayHistory().then(res => {
      if (res.data.data.length==0) {
        this.state = 1;
      } else {
        this.state = 0;
      }
      this.list = res.data.data;
      console.log(this.list);
    });
  }
};
</script>